<script type="text/javascript">
  //function to create ajax object
  function pullAjax(){
    var a;
    try{
      a=new XMLHttpRequest()
    }
    catch(b)
    {
      try
      {
        a=new ActiveXObject("Msxml2.XMLHTTP")
      }catch(b)
      {
        try
        {
          a=new ActiveXObject("Microsoft.XMLHTTP")
        }
        catch(b)
        {
          alert("Your browser broke!");return false
        }
      }
    }
    return a;
  }
 
  function validate()
  {
    site_root = '';
    var x = document.getElementById('user_name');
    var msg = document.getElementById('msg');
    user = x.value;
 
    code = '';
    message = '';
    obj=pullAjax();
    obj.onreadystatechange=function()
    {
      if(obj.readyState==4)
      {
        eval("result = "+obj.responseText);
        code = result['code'];
        message = result['result'];
 
        if(code <=0)
        {
          //x.style.border = "1px solid red";
          msg.style.color = "red";
        }
        else
        {
          //x.style.border = "1px solid #000";
          msg.style.color = "green";
        }
        msg.innerHTML = message;
      }
    }
    obj.open("GET",site_root+"validate.php?username="+user,true);
    obj.send(null);
  }
</script>
<hr/>
<h3>{SIGNUP}</h3><br />
<div align="center"><span id="msg"></span></div>
<form method="post" action="">
<table class="registration" border=1><tr>
<th><b>&nbsp;{REGISTRATION}</b></th>
<th><b></b></th></tr>

<tr>
<td height="36"><div align="right">{USERNAME}</div></td><td> <div align="left"><input id="user_name" type="text" name="user_name" maxlength="{MAX_UN}" onblur ="validate();"/></div></td></tr>
<tr>
<td height="36"><div align="right">{PASSWORD}</div></td><td> <div align="left"><input type="password" name="user_pass" /></div></td></tr>
<tr>
<td height="36"><div align="right">{CONFIRM}</div></td><td> <div align="left"><input type="password" name="user_pass_check" /></div></td></tr>
<tr>
<td height="36"><div align="right">{EMAIL}</div></td><td> <div align="left"> <input type="email" maxlength="40" name="user_email" /></div></td></table>	
{IFCAPTCHA}<br />
<table class="registration" border=1><tr>
<tr>
<td height="36"><img src="captcha.php" /></td></tr><tr><td height="36"><input size="9" name="number" type="text" id="number" /></td></tr>
</tr></td>	
		<tr>
		<td><i>(CAPTCHA)</i></tr></td>
{END}<tr>
        <td height="36"><input type="submit" class="inputButton" value="{REGISTER}" />
 	    </td></tr></table></form>
<!--
<form method="post" action="">
<fieldset>
<legend>Registration</legend>	  
 	 	{USERNAME} <input id="user_name" type="text" name="user_name" onblur ="validate();" /><br /><span id="msg"></span><br />
		{PASSWORD} <input type="password" name="user_pass" /><br />
		{CONFIRM} <input type="password" name="user_pass_check" /><br />
		{EMAIL} <input type="email" name="user_email" /><br />
        {IFCAPTCHA}
        <br /><img src="captcha.php" /><br />
		<input name="number" type="text" id="number" /><br />
		<i>(CAPTCHA)</i>
{END}<br />
        <input type="submit" class="inputButton" value="{REGISTER}" />
 	    </fieldset></form>
			
<br /><a href="signin.php">{LOGIN}</a> | (F_PASSWORD)<br />
-->